home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 771 < prev    next >
Internet Message Format  |  1996-08-06  |  1KB

  1. Path: news.cinenet.net!not-for-mail
  2. From: spitzak@cinenet.net (Bill Spitzak)
  3. Newsgroups: comp.std.c
  4. Subject: Re: Embedded Eacape Sequences ?
  5. Date: 20 Apr 1996 09:39:59 -0700
  6. Organization: Cinenet Communications,Internet Access,Los Angeles;310-301-4500
  7. Message-ID: <4lb40v$r04@hollywood.cinenet.net>
  8. References: <4l80bq$b2k@aplinfo.jhuapl.edu>
  9. NNTP-Posting-Host: hollywood.cinenet.net
  10. X-Newsreader: NN version 6.5.0 #3 (NOV)
  11.  
  12. Stan Novinsky <stan_novinsky@jhuapl.edu> writes:
  13.  
  14. >I have a program that I wish to have some escape sequences
  15. >defined and used.  The escape sequences will work on a 
  16. >VT emulation terminal I am using.  
  17.  
  18. >For instance, I want to place the cursor at the top left
  19. >corner of my terminal screen with ESC//'[01;01H'.
  20. >This works in FORTRAN by defining the 
  21. >   ESC = CHAR(27)
  22. >   TOPL = ESC//'[01;01H'
  23.  
  24. You can put these characters in string constants and then print
  25. them.  The main secret is that the ESC character is '\033' or
  26. equivalently '\x1b' or char(27).
  27.  
  28. The closest equivalent to the above in Ansi C would be:
  29.  
  30.     #define ESC "\033"
  31.     const char *topl = ESC"[01;01H";
  32.  
  33. Since this depends on the string constant appending which you
  34. might not have, just doing:
  35.  
  36.     const char *topl = "\033[01;01H";
  37.  
  38. might be what you want.
  39.  
  40. You are likely to get a lot of messages saying "use curses" or
  41. other things to that effect.  Just ignore them, that is obviously
  42. not what you want.
  43.  
  44. Bill
  45.  
  46.